package com.bclz.task;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * 
* @ClassName: WordCountMapTask  
* @Description: map方法实现
* 				Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> 
* 				 
* @author xuchang  
* @date 2018年9月18日
 */
public class WordCountMapTask extends Mapper<LongWritable, Text, Text, IntWritable> {
		@Override
		protected void map(LongWritable key, Text value, Context context)
				throws IOException, InterruptedException {
			System.out.println("偏移量:"+key);
			// TODO Auto-generated method stub
			String str=value.toString();
			String[] splitStr = str.split(" ");
			for (String s : splitStr) {
					context.write(new Text(s), new IntWritable(1));
			}
			
		}
}
